﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entities;
using BusinessFacade;
using System.Data;
using Comm;

namespace MedicareNoteManagerWeb.Web
{
    public partial class ChangeFunction : BasePage
    {
        sys_menu_Model smm = new sys_menu_Model();
        Busi_sys_Menu bsm = new Busi_sys_Menu();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindDrop();
                this.tb_FunctionName.Text = "";
                this.tb_FunctionURL.Text = "";
            }
        }
        public void BindDrop()
        {
            FillDropDownList("GetMenuDropList", "MenuID", "MenuName", "全部模块", this.ddl_FunctionClass);
        }

        protected void btn_Updata_Click(object sender, EventArgs e)
        {
            smm.MenuName = this.tb_FunctionName.Text;
            smm.MenuUrl = this.tb_FunctionURL.Text;
            smm.MenuParentNo = int.Parse(this.ddl_FunctionClass.SelectedValue);
            if (smm.MenuName != "" && smm.MenuUrl != "" && smm.MenuParentNo.Value != 0)
            {
                if (Busi_sys_Menu.Add1(smm)==true)
                {
                    input.Attributes.Add("style","display:none");
                    OK.Attributes.Add("style","display:block");
                    MessageBox.Show(this.Page, "添加成功");
                }
                else 
                {
                    MessageBox.Show(this.Page, "添加失败！");
                }
            }
            else 
            {
                MessageBox.ShowDialog(Page, "请检查是否有填写的内容！", "error");
            }
        }
    }
}